<h1>Libros y Revistas</h1>
<?php if($sf_user->hasFlash('msg')){ ?>
<div class="message">
  <?php echo $sf_user->getFlash('msg') ?>
</div>
<br />
<?php } ?>
<a href="<?php echo url_for('@publications_new') ?>">Nueva publicación</a>
  <br /><br />
<table width="100%" cellpadding="5" cellspacing="0" border="1" class="list">
  <thead>
  <tr>
    <td>Titulo</td>
    <td>Tipo de publicación</td>
    <td>Opciones</td>
  </tr>
  </thead>
  <tbody>
<?php if($pager->getNbResults()!=0){ ?>
  <?php foreach($pager->getResults() as $row){ ?>
  <tr>
    <td><?php echo html_entity_decode($row->getTitle()); ?></td>
    <td><?php echo $row->getPublicationsType()->getDescription(); ?></td>
    <td>
        <a href="<?php echo url_for('@publications_edit?id='.$row->getId()) ?>">Editar</a>
        <a href="<?php echo url_for('@publications_delete?id='.$row->getId()) ?>" onclick="return delete_confirm()">Eliminar</a>
    </td>
  </tr>
  <?php } ?>
<?php }else{ ?>
  <tr>
      <td colspan="3">No existes registros</td>
  </tr>
<?php } ?>
  </tbody>
</table>
  <br />
<?php if ($pager->haveToPaginate()): ?>
  <div class="pagination">
    <?php if($pager->getFirstPage()!=$pager->getPage()){ ?>
        <a href="?page=<?php echo $pager->getFirstPage() ?>">Inicio</a>
    <?php } ?>
    <?php if($pager->getPreviousPage()!=$pager->getPage()){ ?>
        <a href="?page=<?php echo $pager->getPreviousPage() ?>">Anterior</a>
    <?php } ?>
    <?php foreach ($pager->getLinks(15) as $page): ?>
        <?php if ($page == $pager->getPage()): ?>
            <?php echo $page ?>
        <?php else: ?>
            <a href="?page=<?php echo $page ?>">
                <?php echo $page ?></a>
        <?php endif; ?>
    <?php endforeach; ?>
    <?php if($pager->getNextPage()!=$pager->getPage()){ ?>
        <a href="?page=<?php echo $pager->getNextPage() ?>">Siguiente</a>
    <?php } ?>
    <?php if($pager->getLastPage()!=$pager->getPage()){ ?>
        <a href="?page=<?php echo $pager->getLastPage() ?>">Fin</a>
    <?php } ?>
  </div>
<?php endif; ?>